import { reqGetSearchInfo } from "@/api";

const state = {
    searchInfo: {},
};
const mutations = {
    GETSEARCHINFO(state, searchInfo) {
        state.searchInfo = searchInfo;
    }
};
const actions = {
    async getSearchInfo({ commit }, params = {}) {
        let result = await reqGetSearchInfo(params);
        if (result.code == 200) {
            commit("GETSEARCHINFO", result.data);
        }
    },
};
const getters = {
    goodsList(state) {
        return state.searchInfo.goodsList || [];
    },

    trademarkList(state) {
        return state.searchInfo.trademarkList;
    },

    attrsList() {
        return state.searchInfo.attrsList;
    },
    total() {
        return state.searchInfo.total;
    },
};

export default {
    state,
    mutations,
    actions,
    getters
}